package cn.lanqiao.bigDate.mapper.sys;

import java.util.Set;

import org.apache.ibatis.annotations.*;

@Mapper
public interface LoginMapper{

//	@Select("select count(id) from sys_user where login_name=#{loginName} and password=md5(concat(#{password},salt));")
	@Update("update sys_user set login_ip=#{loginIp},login_date=now() where id=any(select user_id.id from (select id from sys_user where login_name=#{loginName} and password=md5(concat(#{password},salt))) as user_id)")
	int login(String loginName,String password,String loginIp);

	@Select("select url from sys_menu where id in (select menu_id from sys_role_menu where role_id in (select role_id from sys_user_role where user_id =(select id from sys_user where login_name=#{loginName})))")
	Set<String> getMenuList(String loginName);


}